//
//  TMGooglerMacro.m
//  TMGoogler
//
//  Created by Anshu Chimala on 1/10/10.
//  Copyright 2010 Home. All rights reserved.
//

#import "TMGooglerMacro.h"

@implementation TMGooglerMacro
@synthesize delegate = _delegate;

- (NSString *)title {
	return @"Google It!";
}

- (NSString *)author {
	return @"Anshu Chimala";
}

- (NSString *)description {
	return @"Search for stuff on Google.";
}

- (NSString *)beforeText {
	return @"Hmm, I wonder what hotdogs are made from...";
}

- (NSString *)afterText {
	return @"WTF IT'S 4:30 AM AND I'M READING ABOUT PARTICLE ACCELERATORS :(";
}

- (void)processText:(NSString *)text {
	_delegate.shouldPasteAfterwards = NO;
	[[NSWorkspace sharedWorkspace] openURL:
	 [NSURL URLWithString:
	  [@"http://www.google.com/search?q=" stringByAppendingString:
	   [text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];
	[_delegate macro:self didProcessTextWithResult:nil];
}

@end
